package net.uiiang.android.BiscuitBoxDemo.web;

import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class OpenHtmlbyStream extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        WebView webview = new WebView(this);
        setContentView(webview);
        try {
            //index.html在assets文件夹下
            InputStream fin = getAssets().open("index.html");
            byte[] buffer = new byte[fin.available()];
            fin.read(buffer);
            fin.close();
            webview.loadData(new String(buffer), "text/html", "UTF-8");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
